<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - /usr/include/boost/thread/detail/thread.hpp</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../../index.html">top level</a> - <a href="index.html">usr/include/boost/thread/detail</a> - thread.hpp<span style="font-size: 80%;"> (source / <a href="thread.hpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">21</td>
            <td class="headerCovTableEntry">23</td>
            <td class="headerCovTableEntryHi">91.3 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:50:33</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">6</td>
            <td class="headerCovTableEntry">7</td>
            <td class="headerCovTableEntryMed">85.7 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #ifndef BOOST_THREAD_THREAD_COMMON_HPP</a>
<span class="lineNum">       2 </span>            : #define BOOST_THREAD_THREAD_COMMON_HPP
<span class="lineNum">       3 </span>            : // Distributed under the Boost Software License, Version 1.0. (See
<span class="lineNum">       4 </span>            : // accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       5 </span>            : // http://www.boost.org/LICENSE_1_0.txt)
<span class="lineNum">       6 </span>            : // (C) Copyright 2007-2010 Anthony Williams
<span class="lineNum">       7 </span>            : // (C) Copyright 2011-2012 Vicente J. Botet Escriba
<span class="lineNum">       8 </span>            : 
<span class="lineNum">       9 </span>            : #include &lt;boost/thread/detail/config.hpp&gt;
<span class="lineNum">      10 </span>            : #include &lt;boost/predef/platform.h&gt;
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : #include &lt;boost/thread/exceptions.hpp&gt;
<span class="lineNum">      13 </span>            : #ifndef BOOST_NO_IOSTREAM
<span class="lineNum">      14 </span>            : #include &lt;ostream&gt;
<span class="lineNum">      15 </span>            : #endif
<span class="lineNum">      16 </span>            : #include &lt;boost/thread/detail/move.hpp&gt;
<span class="lineNum">      17 </span>            : #include &lt;boost/thread/mutex.hpp&gt;
<span class="lineNum">      18 </span>            : #if defined BOOST_THREAD_USES_DATETIME
<span class="lineNum">      19 </span>            : #include &lt;boost/thread/xtime.hpp&gt;
<span class="lineNum">      20 </span>            : #endif
<span class="lineNum">      21 </span>            : #include &lt;boost/thread/detail/thread_heap_alloc.hpp&gt;
<span class="lineNum">      22 </span>            : #include &lt;boost/thread/detail/make_tuple_indices.hpp&gt;
<span class="lineNum">      23 </span>            : #include &lt;boost/thread/detail/invoke.hpp&gt;
<span class="lineNum">      24 </span>            : #include &lt;boost/thread/detail/is_convertible.hpp&gt;
<span class="lineNum">      25 </span>            : #include &lt;boost/assert.hpp&gt;
<span class="lineNum">      26 </span>            : #include &lt;list&gt;
<span class="lineNum">      27 </span>            : #include &lt;algorithm&gt;
<span class="lineNum">      28 </span>            : #include &lt;boost/core/ref.hpp&gt;
<span class="lineNum">      29 </span>            : #include &lt;boost/cstdint.hpp&gt;
<span class="lineNum">      30 </span>            : #include &lt;boost/bind.hpp&gt;
<span class="lineNum">      31 </span>            : #include &lt;stdlib.h&gt;
<span class="lineNum">      32 </span>            : #include &lt;memory&gt;
<span class="lineNum">      33 </span>            : #include &lt;boost/core/enable_if.hpp&gt;
<span class="lineNum">      34 </span>            : #include &lt;boost/type_traits/remove_reference.hpp&gt;
<span class="lineNum">      35 </span>            : #include &lt;boost/io/ios_state.hpp&gt;
<span class="lineNum">      36 </span>            : #include &lt;boost/type_traits/is_same.hpp&gt;
<span class="lineNum">      37 </span>            : #include &lt;boost/type_traits/decay.hpp&gt;
<span class="lineNum">      38 </span>            : #include &lt;boost/functional/hash.hpp&gt;
<span class="lineNum">      39 </span>            : #ifdef BOOST_THREAD_USES_CHRONO
<span class="lineNum">      40 </span>            : #include &lt;boost/chrono/system_clocks.hpp&gt;
<span class="lineNum">      41 </span>            : #include &lt;boost/chrono/ceil.hpp&gt;
<span class="lineNum">      42 </span>            : #endif
<span class="lineNum">      43 </span>            : 
<span class="lineNum">      44 </span>            : #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
<span class="lineNum">      45 </span>            : #include &lt;tuple&gt;
<span class="lineNum">      46 </span>            : #endif
<span class="lineNum">      47 </span>            : #include &lt;boost/config/abi_prefix.hpp&gt;
<span class="lineNum">      48 </span>            : 
<span class="lineNum">      49 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">      50 </span>            : #pragma warning(push)
<span class="lineNum">      51 </span>            : #pragma warning(disable:4251)
<span class="lineNum">      52 </span>            : #endif
<span class="lineNum">      53 </span>            : 
<span class="lineNum">      54 </span>            : namespace boost
<span class="lineNum">      55 </span>            : {
<span class="lineNum">      56 </span>            : 
<span class="lineNum">      57 </span>            :     namespace detail
<span class="lineNum">      58 </span>            :     {
<span class="lineNum">      59 </span>            : 
<span class="lineNum">      60 </span>            : #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
<span class="lineNum">      61 </span>            : 
<span class="lineNum">      62 </span>            :       template&lt;typename F, class ...ArgTypes&gt;
<span class="lineNum">      63 </span>            :       class thread_data:
<span class="lineNum">      64 </span>            :           public detail::thread_data_base
<span class="lineNum">      65 </span>            :       {
<span class="lineNum">      66 </span>            :       public:
<span class="lineNum">      67 </span>            :           BOOST_THREAD_NO_COPYABLE(thread_data)
<span class="lineNum">      68 </span>            :             thread_data(BOOST_THREAD_RV_REF(F) f_, BOOST_THREAD_RV_REF(ArgTypes)... args_):
<span class="lineNum">      69 </span>            :               fp(boost::forward&lt;F&gt;(f_), boost::forward&lt;ArgTypes&gt;(args_)...)
<span class="lineNum">      70 </span>            :             {}
<span class="lineNum">      71 </span>            :           template &lt;std::size_t ...Indices&gt;
<span class="lineNum">      72 </span>            :           void run2(tuple_indices&lt;Indices...&gt;)
<span class="lineNum">      73 </span>            :           {
<span class="lineNum">      74 </span>            : 
<span class="lineNum">      75 </span>            :               invoke(std::move(std::get&lt;0&gt;(fp)), std::move(std::get&lt;Indices&gt;(fp))...);
<span class="lineNum">      76 </span>            :           }
<span class="lineNum">      77 </span>            :           void run()
<span class="lineNum">      78 </span>            :           {
<span class="lineNum">      79 </span>            :               typedef typename make_tuple_indices&lt;std::tuple_size&lt;std::tuple&lt;F, ArgTypes...&gt; &gt;::value, 1&gt;::type index_type;
<span class="lineNum">      80 </span>            : 
<span class="lineNum">      81 </span>            :               run2(index_type());
<span class="lineNum">      82 </span>            :           }
<span class="lineNum">      83 </span>            : 
<span class="lineNum">      84 </span>            :       private:
<span class="lineNum">      85 </span>            :           std::tuple&lt;typename decay&lt;F&gt;::type, typename decay&lt;ArgTypes&gt;::type...&gt; fp;
<span class="lineNum">      86 </span>            :       };
<span class="lineNum">      87 </span>            : #else // defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
<a name="88"><span class="lineNum">      88 </span>            : </a>
<span class="lineNum">      89 </span>            :         template&lt;typename F&gt;
<span class="lineNum">      90 </span><span class="lineCov">          2 :         class thread_data:</span>
<span class="lineNum">      91 </span>            :             public detail::thread_data_base
<span class="lineNum">      92 </span>            :         {
<span class="lineNum">      93 </span>            :         public:
<span class="lineNum">      94 </span>            :             BOOST_THREAD_NO_COPYABLE(thread_data)
<span class="lineNum">      95 </span>            : #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
<span class="lineNum">      96 </span>            :               thread_data(BOOST_THREAD_RV_REF(F) f_):
<span class="lineNum">      97 </span>            :                 f(boost::forward&lt;F&gt;(f_))
<span class="lineNum">      98 </span>            :               {}
<span class="lineNum">      99 </span>            : // This overloading must be removed if we want the packaged_task's tests to pass.
<span class="lineNum">     100 </span>            : //            thread_data(F&amp; f_):
<span class="lineNum">     101 </span>            : //                f(f_)
<span class="lineNum">     102 </span>            : //            {}
<span class="lineNum">     103 </span>            : #else
<span class="lineNum">     104 </span>            : 
<span class="lineNum">     105 </span>            :             thread_data(BOOST_THREAD_RV_REF(F) f_):
<span class="lineNum">     106 </span>            :               f(f_)
<span class="lineNum">     107 </span>            :             {}
<span class="lineNum">     108 </span>            :             thread_data(F f_):
<span class="lineNum">     109 </span><span class="lineCov">          2 :                 f(f_)</span>
<span class="lineNum">     110 </span>            :             {}
<span class="lineNum">     111 </span>            : #endif
<a name="112"><span class="lineNum">     112 </span>            :             //thread_data() {}</a>
<span class="lineNum">     113 </span>            : 
<span class="lineNum">     114 </span><span class="lineCov">          2 :             void run()</span>
<span class="lineNum">     115 </span>            :             {
<span class="lineNum">     116 </span>            :                 f();
<span class="lineNum">     117 </span><span class="lineCov">          2 :             }</span>
<span class="lineNum">     118 </span>            : 
<span class="lineNum">     119 </span>            :         private:
<span class="lineNum">     120 </span>            :             F f;
<span class="lineNum">     121 </span>            :         };
<span class="lineNum">     122 </span>            : 
<span class="lineNum">     123 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     124 </span>            :         class thread_data&lt;boost::reference_wrapper&lt;F&gt; &gt;:
<span class="lineNum">     125 </span>            :             public detail::thread_data_base
<span class="lineNum">     126 </span>            :         {
<span class="lineNum">     127 </span>            :         private:
<span class="lineNum">     128 </span>            :             F&amp; f;
<span class="lineNum">     129 </span>            :         public:
<span class="lineNum">     130 </span>            :             BOOST_THREAD_NO_COPYABLE(thread_data)
<span class="lineNum">     131 </span>            :             thread_data(boost::reference_wrapper&lt;F&gt; f_):
<span class="lineNum">     132 </span>            :                 f(f_)
<span class="lineNum">     133 </span>            :             {}
<span class="lineNum">     134 </span>            :             void run()
<span class="lineNum">     135 </span>            :             {
<span class="lineNum">     136 </span>            :                 f();
<span class="lineNum">     137 </span>            :             }
<span class="lineNum">     138 </span>            :         };
<span class="lineNum">     139 </span>            : 
<span class="lineNum">     140 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     141 </span>            :         class thread_data&lt;const boost::reference_wrapper&lt;F&gt; &gt;:
<span class="lineNum">     142 </span>            :             public detail::thread_data_base
<span class="lineNum">     143 </span>            :         {
<span class="lineNum">     144 </span>            :         private:
<span class="lineNum">     145 </span>            :             F&amp; f;
<span class="lineNum">     146 </span>            :         public:
<span class="lineNum">     147 </span>            :             BOOST_THREAD_NO_COPYABLE(thread_data)
<span class="lineNum">     148 </span>            :             thread_data(const boost::reference_wrapper&lt;F&gt; f_):
<span class="lineNum">     149 </span>            :                 f(f_)
<span class="lineNum">     150 </span>            :             {}
<span class="lineNum">     151 </span>            :             void run()
<span class="lineNum">     152 </span>            :             {
<span class="lineNum">     153 </span>            :                 f();
<span class="lineNum">     154 </span>            :             }
<span class="lineNum">     155 </span>            :         };
<span class="lineNum">     156 </span>            : #endif
<span class="lineNum">     157 </span>            :     }
<span class="lineNum">     158 </span>            : 
<span class="lineNum">     159 </span>            :     class BOOST_THREAD_DECL thread
<span class="lineNum">     160 </span>            :     {
<span class="lineNum">     161 </span>            :     public:
<span class="lineNum">     162 </span>            :       typedef thread_attributes attributes;
<span class="lineNum">     163 </span>            : 
<span class="lineNum">     164 </span>            :       BOOST_THREAD_MOVABLE_ONLY(thread)
<span class="lineNum">     165 </span>            :     private:
<span class="lineNum">     166 </span>            : 
<span class="lineNum">     167 </span>            :         struct dummy;
<span class="lineNum">     168 </span>            : 
<span class="lineNum">     169 </span>            :         void release_handle();
<span class="lineNum">     170 </span>            : 
<span class="lineNum">     171 </span>            :         detail::thread_data_ptr thread_info;
<span class="lineNum">     172 </span>            : 
<span class="lineNum">     173 </span>            :     private:
<span class="lineNum">     174 </span>            :         bool start_thread_noexcept();
<a name="175"><span class="lineNum">     175 </span>            :         bool start_thread_noexcept(const attributes&amp; attr);</a>
<span class="lineNum">     176 </span>            :     //public:
<span class="lineNum">     177 </span><span class="lineCov">          2 :         void start_thread()</span>
<span class="lineNum">     178 </span>            :         {
<span class="lineNum">     179 </span><span class="lineCov">          2 :           if (!start_thread_noexcept())</span>
<span class="lineNum">     180 </span>            :           {
<span class="lineNum">     181 </span><span class="lineNoCov">          0 :             boost::throw_exception(thread_resource_error());</span>
<span class="lineNum">     182 </span>            :           }
<span class="lineNum">     183 </span><span class="lineCov">          2 :         }</span>
<span class="lineNum">     184 </span>            :         void start_thread(const attributes&amp; attr)
<span class="lineNum">     185 </span>            :         {
<span class="lineNum">     186 </span>            :           if (!start_thread_noexcept(attr))
<span class="lineNum">     187 </span>            :           {
<span class="lineNum">     188 </span>            :             boost::throw_exception(thread_resource_error());
<span class="lineNum">     189 </span>            :           }
<span class="lineNum">     190 </span>            :         }
<span class="lineNum">     191 </span>            : 
<span class="lineNum">     192 </span>            :         explicit thread(detail::thread_data_ptr data);
<span class="lineNum">     193 </span>            : 
<span class="lineNum">     194 </span>            :         detail::thread_data_ptr get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const;
<span class="lineNum">     195 </span>            : 
<span class="lineNum">     196 </span>            : #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
<span class="lineNum">     197 </span>            : #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
<span class="lineNum">     198 </span>            :         template&lt;typename F, class ...ArgTypes&gt;
<span class="lineNum">     199 </span>            :         static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f, BOOST_THREAD_RV_REF(ArgTypes)... args)
<span class="lineNum">     200 </span>            :         {
<span class="lineNum">     201 </span>            :             return detail::thread_data_ptr(detail::heap_new&lt;
<span class="lineNum">     202 </span>            :                   detail::thread_data&lt;typename boost::remove_reference&lt;F&gt;::type, ArgTypes...&gt;
<span class="lineNum">     203 </span>            :                   &gt;(
<span class="lineNum">     204 </span>            :                     boost::forward&lt;F&gt;(f), boost::forward&lt;ArgTypes&gt;(args)...
<span class="lineNum">     205 </span>            :                   )
<span class="lineNum">     206 </span>            :                 );
<span class="lineNum">     207 </span>            :         }
<span class="lineNum">     208 </span>            : #else
<span class="lineNum">     209 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     210 </span>            :         static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f)
<span class="lineNum">     211 </span>            :         {
<span class="lineNum">     212 </span>            :             return detail::thread_data_ptr(detail::heap_new&lt;detail::thread_data&lt;typename boost::remove_reference&lt;F&gt;::type&gt; &gt;(
<span class="lineNum">     213 </span>            :                 boost::forward&lt;F&gt;(f)));
<span class="lineNum">     214 </span>            :         }
<span class="lineNum">     215 </span>            : #endif
<span class="lineNum">     216 </span>            :         static inline detail::thread_data_ptr make_thread_info(void (*f)())
<span class="lineNum">     217 </span>            :         {
<span class="lineNum">     218 </span>            :             return detail::thread_data_ptr(detail::heap_new&lt;detail::thread_data&lt;void(*)()&gt; &gt;(
<span class="lineNum">     219 </span>            :                 boost::forward&lt;void(*)()&gt;(f)));
<span class="lineNum">     220 </span>            :         }
<span class="lineNum">     221 </span>            : #else
<span class="lineNum">     222 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     223 </span>            :         static inline detail::thread_data_ptr make_thread_info(F f
<span class="lineNum">     224 </span>            :             , typename disable_if_c&lt;
<span class="lineNum">     225 </span>            :                 //boost::thread_detail::is_convertible&lt;F&amp;,BOOST_THREAD_RV_REF(F)&gt;::value ||
<span class="lineNum">     226 </span>            :                 is_same&lt;typename decay&lt;F&gt;::type, thread&gt;::value,
<span class="lineNum">     227 </span>            :                 dummy* &gt;::type=0
<span class="lineNum">     228 </span>            :                 )
<span class="lineNum">     229 </span>            :         {
<span class="lineNum">     230 </span><span class="lineCov">          2 :             return detail::thread_data_ptr(detail::heap_new&lt;detail::thread_data&lt;F&gt; &gt;(f));</span>
<span class="lineNum">     231 </span>            :         }
<span class="lineNum">     232 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     233 </span>            :         static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f)
<span class="lineNum">     234 </span>            :         {
<span class="lineNum">     235 </span>            :             return detail::thread_data_ptr(detail::heap_new&lt;detail::thread_data&lt;F&gt; &gt;(f));
<span class="lineNum">     236 </span>            :         }
<span class="lineNum">     237 </span>            : 
<span class="lineNum">     238 </span>            : #endif
<span class="lineNum">     239 </span>            :     public:
<span class="lineNum">     240 </span>            : #if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
<span class="lineNum">     241 </span>            : #if BOOST_WORKAROUND(__SUNPRO_CC, &lt; 0x5100)
<span class="lineNum">     242 </span>            :         thread(const volatile thread&amp;);
<span class="lineNum">     243 </span>            : #endif
<a name="244"><span class="lineNum">     244 </span>            : #endif</a>
<span class="lineNum">     245 </span>            :         thread() BOOST_NOEXCEPT;
<span class="lineNum">     246 </span><span class="lineCov">          2 :         ~thread()</span>
<span class="lineNum">     247 </span><span class="lineCov">          2 :         {</span>
<span class="lineNum">     248 </span>            : 
<span class="lineNum">     249 </span>            :     #if defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
<span class="lineNum">     250 </span>            :           if (joinable()) {
<span class="lineNum">     251 </span>            :             std::terminate();
<span class="lineNum">     252 </span>            :           }
<span class="lineNum">     253 </span>            :     #else
<span class="lineNum">     254 </span><span class="lineCov">          2 :             detach();</span>
<span class="lineNum">     255 </span>            :     #endif
<span class="lineNum">     256 </span><span class="lineCov">          2 :         }</span>
<span class="lineNum">     257 </span>            : #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
<span class="lineNum">     258 </span>            :         template &lt;
<span class="lineNum">     259 </span>            :           class F
<span class="lineNum">     260 </span>            :         &gt;
<span class="lineNum">     261 </span>            :         explicit thread(BOOST_THREAD_RV_REF(F) f
<span class="lineNum">     262 </span>            :         //, typename disable_if&lt;is_same&lt;typename decay&lt;F&gt;::type, thread&gt;, dummy* &gt;::type=0
<span class="lineNum">     263 </span>            :         ):
<span class="lineNum">     264 </span>            :           thread_info(make_thread_info(thread_detail::decay_copy(boost::forward&lt;F&gt;(f))))
<span class="lineNum">     265 </span>            :         {
<span class="lineNum">     266 </span>            :             start_thread();
<span class="lineNum">     267 </span>            :         }
<span class="lineNum">     268 </span>            :         template &lt;
<span class="lineNum">     269 </span>            :           class F
<span class="lineNum">     270 </span>            :         &gt;
<span class="lineNum">     271 </span>            :         thread(attributes const&amp; attrs, BOOST_THREAD_RV_REF(F) f):
<span class="lineNum">     272 </span>            :           thread_info(make_thread_info(thread_detail::decay_copy(boost::forward&lt;F&gt;(f))))
<span class="lineNum">     273 </span>            :         {
<span class="lineNum">     274 </span>            :             start_thread(attrs);
<span class="lineNum">     275 </span>            :         }
<span class="lineNum">     276 </span>            : 
<span class="lineNum">     277 </span>            : #else
<span class="lineNum">     278 </span>            : #ifdef BOOST_NO_SFINAE
<span class="lineNum">     279 </span>            :         template &lt;class F&gt;
<span class="lineNum">     280 </span>            :         explicit thread(F f):
<span class="lineNum">     281 </span>            :             thread_info(make_thread_info(f))
<span class="lineNum">     282 </span>            :         {
<span class="lineNum">     283 </span>            :             start_thread();
<span class="lineNum">     284 </span>            :         }
<span class="lineNum">     285 </span>            :         template &lt;class F&gt;
<span class="lineNum">     286 </span>            :         thread(attributes const&amp; attrs, F f):
<span class="lineNum">     287 </span>            :             thread_info(make_thread_info(f))
<span class="lineNum">     288 </span>            :         {
<span class="lineNum">     289 </span>            :             start_thread(attrs);
<span class="lineNum">     290 </span>            :         }
<span class="lineNum">     291 </span>            : #else
<span class="lineNum">     292 </span>            :         template &lt;class F&gt;
<span class="lineNum">     293 </span>            :         explicit thread(F f
<span class="lineNum">     294 </span>            :         , typename disable_if_c&lt;
<span class="lineNum">     295 </span>            :         boost::thread_detail::is_rv&lt;F&gt;::value // todo ass a thread_detail::is_rv
<span class="lineNum">     296 </span>            :         //boost::thread_detail::is_convertible&lt;F&amp;,BOOST_THREAD_RV_REF(F)&gt;::value
<span class="lineNum">     297 </span>            :             //|| is_same&lt;typename decay&lt;F&gt;::type, thread&gt;::value
<span class="lineNum">     298 </span>            :            , dummy* &gt;::type=0
<span class="lineNum">     299 </span>            :         ):
<span class="lineNum">     300 </span>            :             thread_info(make_thread_info(f))
<span class="lineNum">     301 </span>            :         {
<span class="lineNum">     302 </span>            :             start_thread();
<span class="lineNum">     303 </span>            :         }
<span class="lineNum">     304 </span>            :         template &lt;class F&gt;
<span class="lineNum">     305 </span>            :         thread(attributes const&amp; attrs, F f
<span class="lineNum">     306 </span>            :             , typename disable_if&lt;boost::thread_detail::is_rv&lt;F&gt;, dummy* &gt;::type=0
<span class="lineNum">     307 </span>            :             //, typename disable_if&lt;boost::thread_detail::is_convertible&lt;F&amp;,BOOST_THREAD_RV_REF(F) &gt;, dummy* &gt;::type=0
<span class="lineNum">     308 </span>            :         ):
<span class="lineNum">     309 </span>            :             thread_info(make_thread_info(f))
<span class="lineNum">     310 </span>            :         {
<span class="lineNum">     311 </span>            :             start_thread(attrs);
<span class="lineNum">     312 </span>            :         }
<span class="lineNum">     313 </span>            : #endif
<span class="lineNum">     314 </span>            :         template &lt;class F&gt;
<span class="lineNum">     315 </span>            :         explicit thread(BOOST_THREAD_RV_REF(F) f
<span class="lineNum">     316 </span>            :         , typename disable_if&lt;is_same&lt;typename decay&lt;F&gt;::type, thread&gt;, dummy* &gt;::type=0
<span class="lineNum">     317 </span>            :         ):
<span class="lineNum">     318 </span>            : #ifdef BOOST_THREAD_USES_MOVE
<span class="lineNum">     319 </span>            :         thread_info(make_thread_info(boost::move&lt;F&gt;(f))) // todo : Add forward
<span class="lineNum">     320 </span>            : #else
<span class="lineNum">     321 </span>            :         thread_info(make_thread_info(f)) // todo : Add forward
<span class="lineNum">     322 </span>            : #endif
<span class="lineNum">     323 </span>            :         {
<span class="lineNum">     324 </span>            :             start_thread();
<span class="lineNum">     325 </span>            :         }
<span class="lineNum">     326 </span>            : 
<span class="lineNum">     327 </span>            :         template &lt;class F&gt;
<span class="lineNum">     328 </span>            :         thread(attributes const&amp; attrs, BOOST_THREAD_RV_REF(F) f):
<span class="lineNum">     329 </span>            : #ifdef BOOST_THREAD_USES_MOVE
<span class="lineNum">     330 </span>            :             thread_info(make_thread_info(boost::move&lt;F&gt;(f))) // todo : Add forward
<span class="lineNum">     331 </span>            : #else
<span class="lineNum">     332 </span>            :             thread_info(make_thread_info(f)) // todo : Add forward
<span class="lineNum">     333 </span>            : #endif
<span class="lineNum">     334 </span>            :         {
<span class="lineNum">     335 </span>            :             start_thread(attrs);
<span class="lineNum">     336 </span>            :         }
<span class="lineNum">     337 </span>            : #endif
<span class="lineNum">     338 </span>            :         thread(BOOST_THREAD_RV_REF(thread) x) BOOST_NOEXCEPT
<span class="lineNum">     339 </span>            :         {
<span class="lineNum">     340 </span>            :             thread_info=BOOST_THREAD_RV(x).thread_info;
<span class="lineNum">     341 </span>            :             BOOST_THREAD_RV(x).thread_info.reset();
<span class="lineNum">     342 </span>            :         }
<span class="lineNum">     343 </span>            : #if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF.
<span class="lineNum">     344 </span>            : #if BOOST_WORKAROUND(__SUNPRO_CC, &lt; 0x5100)
<span class="lineNum">     345 </span>            :         thread&amp; operator=(thread x)
<span class="lineNum">     346 </span>            :         {
<span class="lineNum">     347 </span>            :             swap(x);
<span class="lineNum">     348 </span>            :             return *this;
<span class="lineNum">     349 </span>            :         }
<span class="lineNum">     350 </span>            : #endif
<span class="lineNum">     351 </span>            : #endif
<span class="lineNum">     352 </span>            : 
<span class="lineNum">     353 </span>            :         thread&amp; operator=(BOOST_THREAD_RV_REF(thread) other) BOOST_NOEXCEPT
<span class="lineNum">     354 </span>            :         {
<span class="lineNum">     355 </span>            : 
<span class="lineNum">     356 </span>            : #if defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
<span class="lineNum">     357 </span>            :             if (joinable()) std::terminate();
<span class="lineNum">     358 </span>            : #endif
<span class="lineNum">     359 </span>            :             thread_info=BOOST_THREAD_RV(other).thread_info;
<span class="lineNum">     360 </span>            :             BOOST_THREAD_RV(other).thread_info.reset();
<span class="lineNum">     361 </span>            :             return *this;
<span class="lineNum">     362 </span>            :         }
<span class="lineNum">     363 </span>            : 
<span class="lineNum">     364 </span>            : #if defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
<span class="lineNum">     365 </span>            :         template &lt;class F, class Arg, class ...Args&gt;
<span class="lineNum">     366 </span>            :         thread(F&amp;&amp; f, Arg&amp;&amp; arg, Args&amp;&amp;... args) :
<span class="lineNum">     367 </span>            :           thread_info(make_thread_info(
<span class="lineNum">     368 </span>            :               thread_detail::decay_copy(boost::forward&lt;F&gt;(f)),
<span class="lineNum">     369 </span>            :               thread_detail::decay_copy(boost::forward&lt;Arg&gt;(arg)),
<span class="lineNum">     370 </span>            :               thread_detail::decay_copy(boost::forward&lt;Args&gt;(args))...)
<span class="lineNum">     371 </span>            :           )
<span class="lineNum">     372 </span>            : 
<span class="lineNum">     373 </span>            :         {
<span class="lineNum">     374 </span>            :           start_thread();
<span class="lineNum">     375 </span>            :         }
<span class="lineNum">     376 </span>            :         template &lt;class F, class Arg, class ...Args&gt;
<span class="lineNum">     377 </span>            :         thread(attributes const&amp; attrs, F&amp;&amp; f, Arg&amp;&amp; arg, Args&amp;&amp;... args) :
<span class="lineNum">     378 </span>            :           thread_info(make_thread_info(
<span class="lineNum">     379 </span>            :               thread_detail::decay_copy(boost::forward&lt;F&gt;(f)),
<span class="lineNum">     380 </span>            :               thread_detail::decay_copy(boost::forward&lt;Arg&gt;(arg)),
<span class="lineNum">     381 </span>            :               thread_detail::decay_copy(boost::forward&lt;Args&gt;(args))...)
<span class="lineNum">     382 </span>            :           )
<span class="lineNum">     383 </span>            : 
<span class="lineNum">     384 </span>            :         {
<span class="lineNum">     385 </span>            :           start_thread(attrs);
<span class="lineNum">     386 </span>            :         }
<span class="lineNum">     387 </span>            : #else
<span class="lineNum">     388 </span>            :         template &lt;class F,class A1&gt;
<span class="lineNum">     389 </span>            :         thread(F f,A1 a1,typename disable_if&lt;boost::thread_detail::is_convertible&lt;F&amp;,thread_attributes &gt;, dummy* &gt;::type=0):
<span class="lineNum">     390 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1)))
<span class="lineNum">     391 </span>            :         {
<span class="lineNum">     392 </span>            :             start_thread();
<span class="lineNum">     393 </span>            :         }
<span class="lineNum">     394 </span>            :         template &lt;class F,class A1,class A2&gt;
<span class="lineNum">     395 </span>            :         thread(F f,A1 a1,A2 a2):
<span class="lineNum">     396 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2)))
<span class="lineNum">     397 </span>            :         {
<span class="lineNum">     398 </span>            :             start_thread();
<span class="lineNum">     399 </span>            :         }
<span class="lineNum">     400 </span>            : 
<span class="lineNum">     401 </span>            :         template &lt;class F,class A1,class A2,class A3&gt;
<span class="lineNum">     402 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3):
<span class="lineNum">     403 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3)))
<span class="lineNum">     404 </span>            :         {
<span class="lineNum">     405 </span>            :             start_thread();
<span class="lineNum">     406 </span>            :         }
<span class="lineNum">     407 </span>            : 
<span class="lineNum">     408 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4&gt;
<span class="lineNum">     409 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4):
<span class="lineNum">     410 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4)))
<span class="lineNum">     411 </span>            :         {
<span class="lineNum">     412 </span>            :             start_thread();
<span class="lineNum">     413 </span>            :         }
<span class="lineNum">     414 </span>            : 
<span class="lineNum">     415 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4,class A5&gt;
<span class="lineNum">     416 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5):
<span class="lineNum">     417 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4,a5)))
<span class="lineNum">     418 </span>            :         {
<span class="lineNum">     419 </span>            :             start_thread();
<span class="lineNum">     420 </span>            :         }
<span class="lineNum">     421 </span>            : 
<span class="lineNum">     422 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4,class A5,class A6&gt;
<span class="lineNum">     423 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6):
<span class="lineNum">     424 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4,a5,a6)))
<span class="lineNum">     425 </span>            :         {
<span class="lineNum">     426 </span>            :             start_thread();
<span class="lineNum">     427 </span>            :         }
<a name="428"><span class="lineNum">     428 </span>            : </a>
<span class="lineNum">     429 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7&gt;
<span class="lineNum">     430 </span><span class="lineCov">          2 :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7):</span>
<span class="lineNum">     431 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4,a5,a6,a7)))
<span class="lineNum">     432 </span>            :         {
<span class="lineNum">     433 </span><span class="lineCov">          2 :             start_thread();</span>
<span class="lineNum">     434 </span><span class="lineCov">          2 :         }</span>
<span class="lineNum">     435 </span>            : 
<span class="lineNum">     436 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8&gt;
<span class="lineNum">     437 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8):
<span class="lineNum">     438 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4,a5,a6,a7,a8)))
<span class="lineNum">     439 </span>            :         {
<span class="lineNum">     440 </span>            :             start_thread();
<span class="lineNum">     441 </span>            :         }
<span class="lineNum">     442 </span>            : 
<span class="lineNum">     443 </span>            :         template &lt;class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8,class A9&gt;
<span class="lineNum">     444 </span>            :         thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9):
<span class="lineNum">     445 </span>            :             thread_info(make_thread_info(boost::bind(boost::type&lt;void&gt;(),f,a1,a2,a3,a4,a5,a6,a7,a8,a9)))
<span class="lineNum">     446 </span>            :         {
<span class="lineNum">     447 </span>            :             start_thread();
<span class="lineNum">     448 </span>            :         }
<span class="lineNum">     449 </span>            : #endif
<span class="lineNum">     450 </span>            :         void swap(thread&amp; x) BOOST_NOEXCEPT
<span class="lineNum">     451 </span>            :         {
<span class="lineNum">     452 </span>            :             thread_info.swap(x.thread_info);
<span class="lineNum">     453 </span>            :         }
<span class="lineNum">     454 </span>            : 
<span class="lineNum">     455 </span>            :         class id;
<span class="lineNum">     456 </span>            : #ifdef BOOST_THREAD_PLATFORM_PTHREAD
<span class="lineNum">     457 </span>            :         inline id get_id()  const BOOST_NOEXCEPT;
<span class="lineNum">     458 </span>            : #else
<span class="lineNum">     459 </span>            :         id get_id() const BOOST_NOEXCEPT;
<span class="lineNum">     460 </span>            : #endif
<span class="lineNum">     461 </span>            : 
<span class="lineNum">     462 </span>            : 
<span class="lineNum">     463 </span>            :         bool joinable() const BOOST_NOEXCEPT;
<span class="lineNum">     464 </span>            :     private:
<span class="lineNum">     465 </span>            :         bool join_noexcept();
<span class="lineNum">     466 </span>            :     public:
<span class="lineNum">     467 </span>            :         inline void join();
<span class="lineNum">     468 </span>            : 
<span class="lineNum">     469 </span>            : #ifdef BOOST_THREAD_USES_CHRONO
<span class="lineNum">     470 </span>            : #if defined(BOOST_THREAD_PLATFORM_WIN32)
<span class="lineNum">     471 </span>            :         template &lt;class Rep, class Period&gt;
<span class="lineNum">     472 </span>            :         bool try_join_for(const chrono::duration&lt;Rep, Period&gt;&amp; rel_time)
<span class="lineNum">     473 </span>            :         {
<span class="lineNum">     474 </span>            :           chrono::milliseconds rel_time2= chrono::ceil&lt;chrono::milliseconds&gt;(rel_time);
<span class="lineNum">     475 </span>            :           return do_try_join_until(rel_time2.count());
<span class="lineNum">     476 </span>            :         }
<span class="lineNum">     477 </span>            : #else
<span class="lineNum">     478 </span>            :         template &lt;class Rep, class Period&gt;
<span class="lineNum">     479 </span>            :         bool try_join_for(const chrono::duration&lt;Rep, Period&gt;&amp; rel_time)
<span class="lineNum">     480 </span>            :         {
<span class="lineNum">     481 </span>            :           return try_join_until(chrono::steady_clock::now() + rel_time);
<span class="lineNum">     482 </span>            :         }
<span class="lineNum">     483 </span>            : #endif
<span class="lineNum">     484 </span>            :         template &lt;class Clock, class Duration&gt;
<span class="lineNum">     485 </span>            :         bool try_join_until(const chrono::time_point&lt;Clock, Duration&gt;&amp; t)
<span class="lineNum">     486 </span>            :         {
<span class="lineNum">     487 </span>            :           using namespace chrono;
<span class="lineNum">     488 </span>            :           system_clock::time_point     s_now = system_clock::now();
<span class="lineNum">     489 </span>            :           bool joined= false;
<span class="lineNum">     490 </span>            :           do {
<span class="lineNum">     491 </span>            :             typename Clock::duration   d = ceil&lt;nanoseconds&gt;(t-Clock::now());
<span class="lineNum">     492 </span>            :             if (d &lt;= Clock::duration::zero()) return false; // in case the Clock::time_point t is already reached
<span class="lineNum">     493 </span>            :             joined = try_join_until(s_now + d);
<span class="lineNum">     494 </span>            :           } while (! joined);
<span class="lineNum">     495 </span>            :           return true;
<span class="lineNum">     496 </span>            :         }
<span class="lineNum">     497 </span>            :         template &lt;class Duration&gt;
<span class="lineNum">     498 </span>            :         bool try_join_until(const chrono::time_point&lt;chrono::system_clock, Duration&gt;&amp; t)
<span class="lineNum">     499 </span>            :         {
<span class="lineNum">     500 </span>            :           using namespace chrono;
<span class="lineNum">     501 </span>            :           typedef time_point&lt;system_clock, nanoseconds&gt; nano_sys_tmpt;
<span class="lineNum">     502 </span>            :           return try_join_until(nano_sys_tmpt(ceil&lt;nanoseconds&gt;(t.time_since_epoch())));
<span class="lineNum">     503 </span>            :         }
<span class="lineNum">     504 </span>            : #endif
<span class="lineNum">     505 </span>            : #if defined(BOOST_THREAD_PLATFORM_WIN32)
<span class="lineNum">     506 </span>            :     private:
<span class="lineNum">     507 </span>            :         bool do_try_join_until_noexcept(uintmax_t milli, bool&amp; res);
<span class="lineNum">     508 </span>            :         inline bool do_try_join_until(uintmax_t milli);
<span class="lineNum">     509 </span>            :     public:
<span class="lineNum">     510 </span>            :         bool timed_join(const system_time&amp; abs_time);
<span class="lineNum">     511 </span>            :         //{
<span class="lineNum">     512 </span>            :         //  return do_try_join_until(get_milliseconds_until(wait_until));
<span class="lineNum">     513 </span>            :         //}
<span class="lineNum">     514 </span>            : 
<span class="lineNum">     515 </span>            : #ifdef BOOST_THREAD_USES_CHRONO
<span class="lineNum">     516 </span>            :         bool try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp; tp)
<span class="lineNum">     517 </span>            :         {
<span class="lineNum">     518 </span>            :           chrono::milliseconds rel_time= chrono::ceil&lt;chrono::milliseconds&gt;(tp-chrono::system_clock::now());
<span class="lineNum">     519 </span>            :           return do_try_join_until(rel_time.count());
<span class="lineNum">     520 </span>            :         }
<span class="lineNum">     521 </span>            : #endif
<span class="lineNum">     522 </span>            : 
<span class="lineNum">     523 </span>            : 
<span class="lineNum">     524 </span>            : #else
<span class="lineNum">     525 </span>            :     private:
<span class="lineNum">     526 </span>            :         bool do_try_join_until_noexcept(struct timespec const &amp;timeout, bool&amp; res);
<span class="lineNum">     527 </span>            :         inline bool do_try_join_until(struct timespec const &amp;timeout);
<span class="lineNum">     528 </span>            :     public:
<span class="lineNum">     529 </span>            : #if defined BOOST_THREAD_USES_DATETIME
<span class="lineNum">     530 </span>            :         bool timed_join(const system_time&amp; abs_time)
<span class="lineNum">     531 </span>            :         {
<span class="lineNum">     532 </span>            :           struct timespec const ts=detail::to_timespec(abs_time);
<span class="lineNum">     533 </span>            :           return do_try_join_until(ts);
<span class="lineNum">     534 </span>            :         }
<span class="lineNum">     535 </span>            : #endif
<span class="lineNum">     536 </span>            : #ifdef BOOST_THREAD_USES_CHRONO
<span class="lineNum">     537 </span>            :         bool try_join_until(const chrono::time_point&lt;chrono::system_clock, chrono::nanoseconds&gt;&amp; tp)
<span class="lineNum">     538 </span>            :         {
<span class="lineNum">     539 </span>            :           using namespace chrono;
<span class="lineNum">     540 </span>            :           nanoseconds d = tp.time_since_epoch();
<span class="lineNum">     541 </span>            :           timespec ts = boost::detail::to_timespec(d);
<span class="lineNum">     542 </span>            :           return do_try_join_until(ts);
<span class="lineNum">     543 </span>            :         }
<span class="lineNum">     544 </span>            : #endif
<span class="lineNum">     545 </span>            : 
<span class="lineNum">     546 </span>            : #endif
<span class="lineNum">     547 </span>            :       public:
<span class="lineNum">     548 </span>            : 
<span class="lineNum">     549 </span>            : #if defined BOOST_THREAD_USES_DATETIME
<span class="lineNum">     550 </span>            :         template&lt;typename TimeDuration&gt;
<span class="lineNum">     551 </span>            :         inline bool timed_join(TimeDuration const&amp; rel_time)
<span class="lineNum">     552 </span>            :         {
<span class="lineNum">     553 </span>            :             return timed_join(get_system_time()+rel_time);
<span class="lineNum">     554 </span>            :         }
<span class="lineNum">     555 </span>            : #endif
<span class="lineNum">     556 </span>            :         void detach();
<span class="lineNum">     557 </span>            : 
<span class="lineNum">     558 </span>            :         static unsigned hardware_concurrency() BOOST_NOEXCEPT;
<span class="lineNum">     559 </span>            :         static unsigned physical_concurrency() BOOST_NOEXCEPT;
<span class="lineNum">     560 </span>            : 
<span class="lineNum">     561 </span>            : #define BOOST_THREAD_DEFINES_THREAD_NATIVE_HANDLE
<span class="lineNum">     562 </span>            :         typedef detail::thread_data_base::native_handle_type native_handle_type;
<span class="lineNum">     563 </span>            :         native_handle_type native_handle();
<span class="lineNum">     564 </span>            : 
<span class="lineNum">     565 </span>            : #if defined BOOST_THREAD_PROVIDES_THREAD_EQ
<span class="lineNum">     566 </span>            :         // Use thread::id when comparisions are needed
<span class="lineNum">     567 </span>            :         // backwards compatibility
<span class="lineNum">     568 </span>            :         bool operator==(const thread&amp; other) const;
<span class="lineNum">     569 </span>            :         bool operator!=(const thread&amp; other) const;
<span class="lineNum">     570 </span>            : #endif
<span class="lineNum">     571 </span>            : #if defined BOOST_THREAD_USES_DATETIME
<span class="lineNum">     572 </span>            :         static inline void yield() BOOST_NOEXCEPT
<span class="lineNum">     573 </span>            :         {
<span class="lineNum">     574 </span>            :             this_thread::yield();
<span class="lineNum">     575 </span>            :         }
<span class="lineNum">     576 </span>            : 
<span class="lineNum">     577 </span>            :         static inline void sleep(const system_time&amp; xt)
<span class="lineNum">     578 </span>            :         {
<span class="lineNum">     579 </span>            :             this_thread::sleep(xt);
<span class="lineNum">     580 </span>            :         }
<span class="lineNum">     581 </span>            : #endif
<span class="lineNum">     582 </span>            : 
<span class="lineNum">     583 </span>            : #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
<span class="lineNum">     584 </span>            :         // extensions
<span class="lineNum">     585 </span>            :         void interrupt();
<span class="lineNum">     586 </span>            :         bool interruption_requested() const BOOST_NOEXCEPT;
<span class="lineNum">     587 </span>            : #endif
<span class="lineNum">     588 </span>            :     };
<span class="lineNum">     589 </span>            : 
<span class="lineNum">     590 </span>            :     inline void swap(thread&amp; lhs,thread&amp; rhs) BOOST_NOEXCEPT
<span class="lineNum">     591 </span>            :     {
<span class="lineNum">     592 </span>            :         return lhs.swap(rhs);
<span class="lineNum">     593 </span>            :     }
<span class="lineNum">     594 </span>            : 
<span class="lineNum">     595 </span>            : #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
<span class="lineNum">     596 </span>            :     inline thread&amp;&amp; move(thread&amp; t) BOOST_NOEXCEPT
<span class="lineNum">     597 </span>            :     {
<span class="lineNum">     598 </span>            :         return static_cast&lt;thread&amp;&amp;&gt;(t);
<span class="lineNum">     599 </span>            :     }
<span class="lineNum">     600 </span>            : #endif
<span class="lineNum">     601 </span>            : 
<span class="lineNum">     602 </span>            :     BOOST_THREAD_DCL_MOVABLE(thread)
<span class="lineNum">     603 </span>            : 
<span class="lineNum">     604 </span>            :     namespace this_thread
<span class="lineNum">     605 </span>            :     {
<span class="lineNum">     606 </span>            : #ifdef BOOST_THREAD_PLATFORM_PTHREAD
<span class="lineNum">     607 </span>            :         inline thread::id get_id() BOOST_NOEXCEPT;
<span class="lineNum">     608 </span>            : #else
<span class="lineNum">     609 </span>            :         thread::id BOOST_THREAD_DECL get_id() BOOST_NOEXCEPT;
<span class="lineNum">     610 </span>            : #endif
<span class="lineNum">     611 </span>            : 
<span class="lineNum">     612 </span>            : #if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
<span class="lineNum">     613 </span>            :         void BOOST_THREAD_DECL interruption_point();
<span class="lineNum">     614 </span>            :         bool BOOST_THREAD_DECL interruption_enabled() BOOST_NOEXCEPT;
<span class="lineNum">     615 </span>            :         bool BOOST_THREAD_DECL interruption_requested() BOOST_NOEXCEPT;
<span class="lineNum">     616 </span>            : #endif
<span class="lineNum">     617 </span>            : 
<span class="lineNum">     618 </span>            : #if defined BOOST_THREAD_USES_DATETIME
<span class="lineNum">     619 </span>            :         inline BOOST_SYMBOL_VISIBLE void sleep(xtime const&amp; abs_time)
<span class="lineNum">     620 </span>            :         {
<span class="lineNum">     621 </span>            :             sleep(system_time(abs_time));
<span class="lineNum">     622 </span>            :         }
<span class="lineNum">     623 </span>            : #endif
<span class="lineNum">     624 </span>            :     }
<span class="lineNum">     625 </span>            : 
<span class="lineNum">     626 </span>            :     class BOOST_SYMBOL_VISIBLE thread::id
<span class="lineNum">     627 </span>            :     {
<span class="lineNum">     628 </span>            :     private:
<span class="lineNum">     629 </span>            :         friend inline
<span class="lineNum">     630 </span>            :         std::size_t
<span class="lineNum">     631 </span>            :         hash_value(const thread::id &amp;v)
<span class="lineNum">     632 </span>            :         {
<span class="lineNum">     633 </span>            : #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
<span class="lineNum">     634 </span>            :           return hash_value(v.thread_data);
<span class="lineNum">     635 </span>            : #else
<span class="lineNum">     636 </span>            :           return hash_value(v.thread_data.get());
<span class="lineNum">     637 </span>            : #endif
<span class="lineNum">     638 </span>            :         }
<span class="lineNum">     639 </span>            : 
<span class="lineNum">     640 </span>            : #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
<span class="lineNum">     641 </span>            : #if defined(BOOST_THREAD_PLATFORM_WIN32)
<span class="lineNum">     642 </span>            :         typedef unsigned int data;
<span class="lineNum">     643 </span>            : #else
<span class="lineNum">     644 </span>            :         typedef thread::native_handle_type data;
<span class="lineNum">     645 </span>            : #endif
<span class="lineNum">     646 </span>            : #else
<span class="lineNum">     647 </span>            :         typedef detail::thread_data_ptr data;
<span class="lineNum">     648 </span>            : #endif
<span class="lineNum">     649 </span>            :         data thread_data;
<span class="lineNum">     650 </span>            : 
<span class="lineNum">     651 </span>            :         id(data thread_data_):
<span class="lineNum">     652 </span>            :             thread_data(thread_data_)
<span class="lineNum">     653 </span>            :         {}
<span class="lineNum">     654 </span>            :         friend class thread;
<span class="lineNum">     655 </span>            :         friend id BOOST_THREAD_DECL this_thread::get_id() BOOST_NOEXCEPT;
<span class="lineNum">     656 </span>            :     public:
<span class="lineNum">     657 </span>            :         id() BOOST_NOEXCEPT:
<span class="lineNum">     658 </span>            : #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
<span class="lineNum">     659 </span>            :         thread_data(0)
<span class="lineNum">     660 </span>            : #else
<span class="lineNum">     661 </span>            :         thread_data()
<span class="lineNum">     662 </span>            : #endif
<span class="lineNum">     663 </span>            :         {}
<span class="lineNum">     664 </span>            : 
<span class="lineNum">     665 </span>            :         id(const id&amp; other) BOOST_NOEXCEPT :
<span class="lineNum">     666 </span>            :             thread_data(other.thread_data)
<span class="lineNum">     667 </span>            :         {}
<span class="lineNum">     668 </span>            : 
<span class="lineNum">     669 </span>            :         bool operator==(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     670 </span>            :         {
<span class="lineNum">     671 </span>            :             return thread_data==y.thread_data;
<span class="lineNum">     672 </span>            :         }
<span class="lineNum">     673 </span>            : 
<span class="lineNum">     674 </span>            :         bool operator!=(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     675 </span>            :         {
<span class="lineNum">     676 </span>            :             return thread_data!=y.thread_data;
<span class="lineNum">     677 </span>            :         }
<span class="lineNum">     678 </span>            : 
<span class="lineNum">     679 </span>            :         bool operator&lt;(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     680 </span>            :         {
<span class="lineNum">     681 </span>            :             return thread_data&lt;y.thread_data;
<span class="lineNum">     682 </span>            :         }
<span class="lineNum">     683 </span>            : 
<span class="lineNum">     684 </span>            :         bool operator&gt;(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     685 </span>            :         {
<span class="lineNum">     686 </span>            :             return y.thread_data&lt;thread_data;
<span class="lineNum">     687 </span>            :         }
<span class="lineNum">     688 </span>            : 
<span class="lineNum">     689 </span>            :         bool operator&lt;=(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     690 </span>            :         {
<span class="lineNum">     691 </span>            :             return !(y.thread_data&lt;thread_data);
<span class="lineNum">     692 </span>            :         }
<span class="lineNum">     693 </span>            : 
<span class="lineNum">     694 </span>            :         bool operator&gt;=(const id&amp; y) const BOOST_NOEXCEPT
<span class="lineNum">     695 </span>            :         {
<span class="lineNum">     696 </span>            :             return !(thread_data&lt;y.thread_data);
<span class="lineNum">     697 </span>            :         }
<span class="lineNum">     698 </span>            : 
<span class="lineNum">     699 </span>            : #ifndef BOOST_NO_IOSTREAM
<span class="lineNum">     700 </span>            : #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
<span class="lineNum">     701 </span>            :         template&lt;class charT, class traits&gt;
<span class="lineNum">     702 </span>            :         friend BOOST_SYMBOL_VISIBLE
<span class="lineNum">     703 </span>            :   std::basic_ostream&lt;charT, traits&gt;&amp;
<span class="lineNum">     704 </span>            :         operator&lt;&lt;(std::basic_ostream&lt;charT, traits&gt;&amp; os, const id&amp; x)
<span class="lineNum">     705 </span>            :         {
<span class="lineNum">     706 </span>            :             if(x.thread_data)
<span class="lineNum">     707 </span>            :             {
<span class="lineNum">     708 </span>            :                 io::ios_flags_saver  ifs( os );
<span class="lineNum">     709 </span>            :                 return os&lt;&lt; std::hex &lt;&lt; x.thread_data;
<span class="lineNum">     710 </span>            :             }
<span class="lineNum">     711 </span>            :             else
<span class="lineNum">     712 </span>            :             {
<span class="lineNum">     713 </span>            :                 return os&lt;&lt;&quot;{Not-any-thread}&quot;;
<span class="lineNum">     714 </span>            :             }
<span class="lineNum">     715 </span>            :         }
<span class="lineNum">     716 </span>            : #else
<span class="lineNum">     717 </span>            :         template&lt;class charT, class traits&gt;
<span class="lineNum">     718 </span>            :         BOOST_SYMBOL_VISIBLE
<span class="lineNum">     719 </span>            :   std::basic_ostream&lt;charT, traits&gt;&amp;
<span class="lineNum">     720 </span>            :         print(std::basic_ostream&lt;charT, traits&gt;&amp; os) const
<span class="lineNum">     721 </span>            :         {
<span class="lineNum">     722 </span>            :             if(thread_data)
<span class="lineNum">     723 </span>            :             {
<span class="lineNum">     724 </span>            :               io::ios_flags_saver  ifs( os );
<span class="lineNum">     725 </span>            :               return os&lt;&lt; std::hex &lt;&lt; thread_data;
<span class="lineNum">     726 </span>            :             }
<span class="lineNum">     727 </span>            :             else
<span class="lineNum">     728 </span>            :             {
<span class="lineNum">     729 </span>            :                 return os&lt;&lt;&quot;{Not-any-thread}&quot;;
<span class="lineNum">     730 </span>            :             }
<span class="lineNum">     731 </span>            :         }
<span class="lineNum">     732 </span>            : 
<span class="lineNum">     733 </span>            : #endif
<span class="lineNum">     734 </span>            : #endif
<span class="lineNum">     735 </span>            :     };
<span class="lineNum">     736 </span>            : 
<span class="lineNum">     737 </span>            : #ifdef BOOST_THREAD_PLATFORM_PTHREAD
<span class="lineNum">     738 </span>            :     thread::id thread::get_id() const BOOST_NOEXCEPT
<span class="lineNum">     739 </span>            :     {
<span class="lineNum">     740 </span>            :     #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
<span class="lineNum">     741 </span><span class="lineCov">          2 :         return const_cast&lt;thread*&gt;(this)-&gt;native_handle();</span>
<span class="lineNum">     742 </span>            :     #else
<span class="lineNum">     743 </span>            :         detail::thread_data_ptr const local_thread_info=(get_thread_info)();
<span class="lineNum">     744 </span>            :         return (local_thread_info? id(local_thread_info) : id());
<span class="lineNum">     745 </span>            :     #endif
<span class="lineNum">     746 </span>            :     }
<span class="lineNum">     747 </span>            : 
<span class="lineNum">     748 </span>            :     namespace this_thread
<span class="lineNum">     749 </span>            :     {
<span class="lineNum">     750 </span>            :         inline thread::id get_id() BOOST_NOEXCEPT
<span class="lineNum">     751 </span>            :         {
<span class="lineNum">     752 </span>            :         #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
<span class="lineNum">     753 </span><span class="lineCov">          2 :              return pthread_self();</span>
<span class="lineNum">     754 </span>            :         #else
<span class="lineNum">     755 </span>            :             boost::detail::thread_data_base* const thread_info=get_or_make_current_thread_data();
<span class="lineNum">     756 </span>            :             return (thread_info?thread::id(thread_info-&gt;shared_from_this()):thread::id());
<span class="lineNum">     757 </span>            :         #endif
<span class="lineNum">     758 </span>            :         }
<a name="759"><span class="lineNum">     759 </span>            :     }</a>
<span class="lineNum">     760 </span>            : #endif
<span class="lineNum">     761 </span><span class="lineCov">          2 :     void thread::join() {</span>
<span class="lineNum">     762 </span><span class="lineCov">          2 :         if (this_thread::get_id() == get_id())</span>
<span class="lineNum">     763 </span><span class="lineNoCov">          0 :           boost::throw_exception(thread_resource_error(static_cast&lt;int&gt;(system::errc::resource_deadlock_would_occur), &quot;boost thread: trying joining itself&quot;));</span>
<span class="lineNum">     764 </span>            : 
<span class="lineNum">     765 </span>            :         BOOST_THREAD_VERIFY_PRECONDITION( join_noexcept(),
<span class="lineNum">     766 </span>            :             thread_resource_error(static_cast&lt;int&gt;(system::errc::invalid_argument), &quot;boost thread: thread not joinable&quot;)
<span class="lineNum">     767 </span><span class="lineCov">          2 :         );</span>
<span class="lineNum">     768 </span><span class="lineCov">          2 :     }</span>
<span class="lineNum">     769 </span>            : 
<span class="lineNum">     770 </span>            : #ifdef BOOST_THREAD_PLATFORM_PTHREAD
<span class="lineNum">     771 </span>            :     bool thread::do_try_join_until(struct timespec const &amp;timeout)
<span class="lineNum">     772 </span>            : #else
<span class="lineNum">     773 </span>            :     bool thread::do_try_join_until(uintmax_t timeout)
<span class="lineNum">     774 </span>            : #endif
<span class="lineNum">     775 </span>            :     {
<span class="lineNum">     776 </span>            :         if (this_thread::get_id() == get_id())
<span class="lineNum">     777 </span>            :           boost::throw_exception(thread_resource_error(static_cast&lt;int&gt;(system::errc::resource_deadlock_would_occur), &quot;boost thread: trying joining itself&quot;));
<span class="lineNum">     778 </span>            :         bool res;
<span class="lineNum">     779 </span>            :         if (do_try_join_until_noexcept(timeout, res))
<span class="lineNum">     780 </span>            :         {
<span class="lineNum">     781 </span>            :           return res;
<span class="lineNum">     782 </span>            :         }
<span class="lineNum">     783 </span>            :         else
<span class="lineNum">     784 </span>            :         {
<span class="lineNum">     785 </span>            :           BOOST_THREAD_THROW_ELSE_RETURN(
<span class="lineNum">     786 </span>            :             (thread_resource_error(static_cast&lt;int&gt;(system::errc::invalid_argument), &quot;boost thread: thread not joinable&quot;)),
<span class="lineNum">     787 </span>            :             false
<span class="lineNum">     788 </span>            :           );
<span class="lineNum">     789 </span>            :         }
<span class="lineNum">     790 </span>            :     }
<span class="lineNum">     791 </span>            : 
<span class="lineNum">     792 </span>            : #if !defined(BOOST_NO_IOSTREAM) &amp;&amp; defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
<span class="lineNum">     793 </span>            :     template&lt;class charT, class traits&gt;
<span class="lineNum">     794 </span>            :     BOOST_SYMBOL_VISIBLE
<span class="lineNum">     795 </span>            :     std::basic_ostream&lt;charT, traits&gt;&amp;
<span class="lineNum">     796 </span>            :     operator&lt;&lt;(std::basic_ostream&lt;charT, traits&gt;&amp; os, const thread::id&amp; x)
<span class="lineNum">     797 </span>            :     {
<span class="lineNum">     798 </span>            :         return x.print(os);
<span class="lineNum">     799 </span>            :     }
<span class="lineNum">     800 </span>            : #endif
<span class="lineNum">     801 </span>            : 
<span class="lineNum">     802 </span>            : #if defined BOOST_THREAD_PROVIDES_THREAD_EQ
<span class="lineNum">     803 </span>            :     inline bool thread::operator==(const thread&amp; other) const
<span class="lineNum">     804 </span>            :     {
<span class="lineNum">     805 </span>            :         return get_id()==other.get_id();
<span class="lineNum">     806 </span>            :     }
<span class="lineNum">     807 </span>            : 
<span class="lineNum">     808 </span>            :     inline bool thread::operator!=(const thread&amp; other) const
<span class="lineNum">     809 </span>            :     {
<span class="lineNum">     810 </span>            :         return get_id()!=other.get_id();
<span class="lineNum">     811 </span>            :     }
<span class="lineNum">     812 </span>            : #endif
<span class="lineNum">     813 </span>            : 
<span class="lineNum">     814 </span>            :     namespace detail
<span class="lineNum">     815 </span>            :     {
<span class="lineNum">     816 </span>            :         struct thread_exit_function_base
<span class="lineNum">     817 </span>            :         {
<span class="lineNum">     818 </span>            :             virtual ~thread_exit_function_base()
<span class="lineNum">     819 </span>            :             {}
<span class="lineNum">     820 </span>            :             virtual void operator()()=0;
<span class="lineNum">     821 </span>            :         };
<span class="lineNum">     822 </span>            : 
<span class="lineNum">     823 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     824 </span>            :         struct thread_exit_function:
<span class="lineNum">     825 </span>            :             thread_exit_function_base
<span class="lineNum">     826 </span>            :         {
<span class="lineNum">     827 </span>            :             F f;
<span class="lineNum">     828 </span>            : 
<span class="lineNum">     829 </span>            :             thread_exit_function(F f_):
<span class="lineNum">     830 </span>            :                 f(f_)
<span class="lineNum">     831 </span>            :             {}
<span class="lineNum">     832 </span>            : 
<span class="lineNum">     833 </span>            :             void operator()()
<span class="lineNum">     834 </span>            :             {
<span class="lineNum">     835 </span>            :                 f();
<span class="lineNum">     836 </span>            :             }
<span class="lineNum">     837 </span>            :         };
<span class="lineNum">     838 </span>            : 
<span class="lineNum">     839 </span>            :         void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*);
<span class="lineNum">     840 </span>            :         struct shared_state_base;
<span class="lineNum">     841 </span>            : #if defined(BOOST_THREAD_PLATFORM_WIN32)
<span class="lineNum">     842 </span>            :         inline void make_ready_at_thread_exit(shared_ptr&lt;shared_state_base&gt; as)
<span class="lineNum">     843 </span>            :         {
<span class="lineNum">     844 </span>            :           detail::thread_data_base* const current_thread_data(detail::get_current_thread_data());
<span class="lineNum">     845 </span>            :           if(current_thread_data)
<span class="lineNum">     846 </span>            :           {
<span class="lineNum">     847 </span>            :             current_thread_data-&gt;make_ready_at_thread_exit(as);
<span class="lineNum">     848 </span>            :           }
<span class="lineNum">     849 </span>            :         }
<span class="lineNum">     850 </span>            : #else
<span class="lineNum">     851 </span>            :         void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr&lt;shared_state_base&gt; as);
<span class="lineNum">     852 </span>            : #endif
<span class="lineNum">     853 </span>            :     }
<span class="lineNum">     854 </span>            : 
<span class="lineNum">     855 </span>            :     namespace this_thread
<span class="lineNum">     856 </span>            :     {
<span class="lineNum">     857 </span>            :         template&lt;typename F&gt;
<span class="lineNum">     858 </span>            :         void at_thread_exit(F f)
<span class="lineNum">     859 </span>            :         {
<span class="lineNum">     860 </span>            :             detail::thread_exit_function_base* const thread_exit_func=detail::heap_new&lt;detail::thread_exit_function&lt;F&gt; &gt;(f);
<span class="lineNum">     861 </span>            :             detail::add_thread_exit_function(thread_exit_func);
<span class="lineNum">     862 </span>            :         }
<span class="lineNum">     863 </span>            :     }
<span class="lineNum">     864 </span>            : }
<span class="lineNum">     865 </span>            : 
<span class="lineNum">     866 </span>            : #ifdef BOOST_MSVC
<span class="lineNum">     867 </span>            : #pragma warning(pop)
<span class="lineNum">     868 </span>            : #endif
<span class="lineNum">     869 </span>            : 
<span class="lineNum">     870 </span>            : #include &lt;boost/config/abi_suffix.hpp&gt;
<span class="lineNum">     871 </span>            : 
<span class="lineNum">     872 </span>            : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
